<?php 
//载入函数
include '../../functions.php';
//载入smarty
include '../smarty/libs/Smarty.class.php';
//实例化
$smarty = new Smarty;
//模板目录
$smarty->template_dir = "template";
//编译目录
$smarty->compile_dir = "temp/compile";
//开始定界符
$smarty->left_delimiter ="{{";
//结束定界符
$smarty->right_delimiter = "}}";




/*try{
		//连接数据库
	    $pdo = new Pdo("mysql:host=127.0.0.1;dbname=zuoye","root","");
		//设置字符集
		$pdo->query("set names utf8");
		//错误属性
		$pdo->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
		//执行spl
		$result = $pdo->query("select * from news");
		//接收结果集
		$rows = $result->fetchAll(PDO::FETCH_ASSOC);
 * 	    
	}catch(PDOException $e){
	     echo $e->getMessage();
	}
$smarty->assign('data',$rows);	
*/
//和上面结果是一样的
//query是一个函数，请看functions.php
$data = query("select * from news");	
$smarty->assign("data",$data);


$len = "1234567890abc";
$len = "春天里的一把火，熊熊火焰燃烧了我";
$smarty->assign('len',$len);

//自定义变量调节器
$data1 = '你好美';	
$smarty->assign("data1",$data1);




//载入模板文件
$smarty->display('index.html');




